Skip to content

fix(document-api): make tables tracked-mode capability honest - #3742

Open
marekgit200 wants to merge 1 commit into
superdoc:v1from
marekgit200:fix/tables-tracked-capability-honesty
Open

marekgit200 wants to merge 1 commit into
superdoc:v1from
marekgit200:fix/tables-tracked-capability-honesty

Conversation

@marekgit200

Copy link
Copy Markdown

What

capabilities().operations[op].tracked reported true for four table operations, but only tables.insertRow could actually produce a tracked change. The other three silently applied direct edits when called with changeMode: 'tracked' — and tables.deleteRow physically removed the row with no w:del marker, i.e. data loss in suggesting mode.

Why it happened

The inline overlap compiler can't represent tableRow insert/delete steps, and the review model (structuralRowChanges.js) only treats a whole-table insert/delete as a decidable change. So a row/column-level operation has no decidable tracked representation, and the tracked path failed closed to a direct apply.

Changes

  • tables.insertRow keeps tracked support — it stamps a structural rowInsert revision matching the importer shape (row-track-change.js), which exports as w:ins inside w:trPr so Word can accept/reject it. Rows inserted in one call now share a single revisionGroupId.
  • tables.deleteRow / tables.insertColumn / tables.deleteColumn now reject changeMode: 'tracked' with CAPABILITY_UNAVAILABLE (the existing rejectTrackedMode convention) and report supportsTrackedMode: false.
  • Regenerated Document API reference docs for the flipped flags.
  • Registers plan.execute as a plan-engine meta-op in the adapter conformance test — it was added to the contract without being exempted from per-operation vector coverage, which had left the suite red on main.

Behavior change (worth a reviewer's eye)

Calling those three ops in tracked mode now throws instead of silently succeeding, and their capability flag flips to false. This trades a silent-wrong / data-loss path for a loud, honest one.

Test plan

  • New tests: insertRow tracked stamps rowInsert and exports w:ins; a multi-row insert shares one revisionGroupId; direct mode does not stamp; the three sibling ops reject tracked mode with CAPABILITY_UNAVAILABLE.
  • pnpm check:public (superdoc 14/14 + docapi 4/4), pnpm check:types, the adapter conformance + convenience suites, prettier, and eslint all pass.
  • No visual changes — API / capability behavior only.

Closes #3594

@marekgit200
marekgit200 requested a review from a team as a code owner June 16, 2026 10:43
@caio-pizzol
caio-pizzol force-pushed the fix/tables-tracked-capability-honesty branch from c08ef01 to 64124bd Compare June 23, 2026 19:51
tables.insertRow/deleteRow/insertColumn/deleteColumn all reported capabilities().<op>.tracked=true, but only insertRow could produce a tracked change. The others silently applied direct edits under changeMode:'tracked', and tables.deleteRow physically removed the row with no w:del marker (data loss in suggesting mode).

Root cause: the inline overlap compiler cannot represent tableRow insert/delete steps, and the review model only treats a whole-table insert/delete as decidable (structuralRowChanges.js).

insertRow keeps tracked support: it stamps a rowInsert revision that exports as a w:ins marker, and rows from one call share a single revisionGroupId. deleteRow/insertColumn/deleteColumn now reject changeMode:tracked with CAPABILITY_UNAVAILABLE and report supportsTrackedMode:false. Reference docs regenerated.

Closes superdoc#3594
@caio-pizzol
caio-pizzol force-pushed the fix/tables-tracked-capability-honesty branch from 64124bd to c8956da Compare June 23, 2026 20:03
@caio-pizzol

Copy link
Copy Markdown
Contributor

Thanks for this, @marekgit200. I refreshed the branch against current main and regenerated the Document API docs so we can review it.

I also dropped one stale hunk because plan.execute is already handled on main. The table tracked-mode fix itself is unchanged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants